#pragma once
#include <game/Config.h>
#include <game/Service.h>
#include <Signals.h>

namespace liba {
namespace lib3d {
class Application;
} // namespace lib3d
} // namespace liba

ARELLO_GAME_NAMESPACE_DECL_START 
class GameApplication;
namespace services {

class ApplicationService
	: public game::Service<ApplicationService>
{
	friend class ::game::GameApplication; 
public:
	ApplicationService(liba::lib3d::Application* app);
	/** Forces application to display loading screen. */
	void ForceLoadingScreen();

	bool IsLoading() const { return this->isLoading; }

	/** In order for the following notifications to work, derive your application from GameApplication class. */
	liba::signals::signal<void ()>& LoadingStarted() { return this->loadingStarted; }
	liba::signals::signal<void ()>& LoadingFinished() { return this->loadingFinished; }
private:
	liba::lib3d::Application* application;

	void InvokeLoadingStarted();
	void InvokeLoadingFinished();

	liba::signals::signal<void ()> loadingStarted;
	liba::signals::signal<void ()> loadingFinished;

	bool isLoading;
};

} // namespace services
ARELLO_GAME_NAMESPACE_DECL_END